<!DOCTYPE html>
<html lang="zh">
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title>设备维修</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link href="../static/ajax/libs/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../static/css/animate.css" rel="stylesheet"/>
    <link href="../static/css/style.css" rel="stylesheet"/>
    <link href="../static/ruoyi/css/ry-ui.css" rel="stylesheet"/>

    <link href="../static/ajax/libs/jquery-layout/jquery.layout-latest.css" rel="stylesheet"/>

    <link href="../static/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css" rel="stylesheet"/>

</head>
<body class="gray-bg">

<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="user-form">
                    <input type="hidden" id="deptId" name="deptId">
                    <input type="hidden" id="parentId" name="parentId">
                    <div class="select-list">
                        <ul>
                            <li>
                                设备名称：<input type="text" name=""/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()">
                                    <i class="fa fa-search"></i>&nbsp;搜索
                                </a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()">
                                    <i class="fa fa-refresh"></i>&nbsp;重置
                                </a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>


            <div class="col-sm-12 select-table table-striped">
                <div class="bootstrap-table">
                    <div class="fixed-table-toolbar">
                        <div class="bs-bars pull-left">
                            <div class="btn-group-sm" id="toolbar" role="group">
                                <button class="btn btn-info" data-toggle="modal" data-target="#myModal" >
                                    <i class="fa fa-upload"></i> 维修登记
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="fixed-table-container" style="padding-bottom: 0px;">
                        <div class="fixed-table-header" style="display: none;">
                            <table></table>
                        </div>
                        <div class="fixed-table-body">
                            <div class="fixed-table-loading" style="top: 41px; display: none;">正在努力地加载数据中，请稍候……</div>
                            <table id="bootstrap-table" data-mobile-responsive="true" class="table table-hover">
                                <thead>
                                <tr>
                                    <th class="bs-checkbox " style="width: 36px;">
                                        <div class="th-inner ">
                                            <input name="btSelectAll" type="checkbox">
                                        </div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">设备编号</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner sortable both">设备型号</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner sortable both">设备名称</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">设备维修缘由</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">设备维修状态</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">设备维修价格</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">设备维修时间</div>
                                        <div class="fht-cell"></div>
                                    </th>
                                    <th>
                                        <div class="th-inner ">设备维修人员</div>
                                        <div class="fht-cell"></div>
                                    </th>

                                </tr>
                                </thead>

                                <tbody>
                                <tr data-index="0">
                                    <td class="bs-checkbox ">
                                        <input data-index="0" name="btSelectItem" type="checkbox">
                                    </td>
                                    <td>D20190001</td>
                                    <td>110式</td>
                                    <td>滚筒杀青机</td>
                                    <td>电机坏了</td>
                                    <td>正常</td>
                                    <td>3000</td>
                                    <td>2019-07-29 15:22:23</td>
                                    <td>yzl</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="fixed-table-footer" style="display: none;">
                            <table>
                                <tbody>
                                <tr></tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="fixed-table-pagination" style="display: block;">
                            <div class="pull-left pagination-detail">
                                <span class="pagination-info">第 1 到 2 条，共  2 条记录。</span>
                                <span class="page-list"  style="display: none;">
                                <span class="btn-group dropup">
                                    <button type="button" class="btn btn-default btn-outline dropdown-toggle" data-toggle="dropdown">
                                        <span class="page-size">10</span>
                                        <span class="caret"></span>
                                    </button>
                            <ul class="dropdown-menu" role="menu">
                                <li class="active">
                                    <a href="javascript:void(0)">10</a>
                                </li>
                            </ul>
                                </span> 条记录每页</span>
                            </div>
                            <div class="pull-right pagination" style="display: none;">
                                <ul class="pagination pagination-outline">
                                    <li class="page-pre"><a href="javascript:void(0)">‹</a></li>
                                    <li class="page-number active"><a href="javascript:void(0)">1</a></li>
                                    <li class="page-next"><a href="javascript:void(0)">›</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>


        </div>
    </div>
</div>

<div class="modal inmodal" id="myModal" tabindex="-1" role="dialog" aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content animated bounceInRight">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span>
                </button>
                <i class="fa fa-laptop modal-icon"></i>
                <h4 class="modal-title">维修登记</h4>
            </div><small class="font-bold">
            <div class="modal-body">
                <div class="modal-body">
                  <form>
                    <div class="form-group">
                      <label for="recipient-name" class="control-label">设备编号：</label>
                      <input type="text" class="form-control" id="recipient-name">
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">设备型号：</label>
                      <select class="form-control">
                        <option>110</option>
                        <option>57</option>
                        <option>...</option>
                      </select>
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">设备名：</label>
                      <input type="text" class="form-control" id="recipient-name">
                    </div>
                     <div class="form-group">
                      <label for="message-text" class="control-label">状态：</label>
                      <select class="form-control">
                        <option>正常</option>
                        <option>异常</option>
                        <option>报废</option>
                      </select>
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">设备维修缘由：</label>
                      <input class="form-control" id="message-text"></input>
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">设备维修价格：</label>
                      <input class="form-control" id="message-varieties"></input>
                    </div>
                    <div class="form-group">
                      <label for="message-text" class="control-label">设备维修人员：</label>
                      <input class="form-control" id="message-varieties"></input>
                    </div>
                  </form>

                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary">保存</button>
            </div>
        </small></div><small class="font-bold">
    </small></div><small class="font-bold">
</small></div>



<script src="../static/js/jquery.min.js"></script>
<script src="../static/js/bootstrap.min.js"></script>
<!-- bootstrap-table 表格插件 -->
<script src="../static/ajax/libs/bootstrap-table/bootstrap-table.min.js"></script>
<script src="../static/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="../static/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js"></script>
<script src="../static/ajax/libs/bootstrap-table/extensions/toolbar/bootstrap-table-toolbar.min.js"></script>
<script src="../static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="../static/ajax/libs/validate/jquery.validate.min.js"></script>
<script src="../static/ajax/libs/validate/messages_zh.min.js"></script>
<script src="../static/ajax/libs/validate/jquery.validate.extend.js"></script>
<!-- jquery-validate 表单树插件 -->
<script src="../static/ajax/libs/bootstrap-treetable/bootstrap-treetable.js"></script>
<!-- jquery-export 表格导出插件 -->
<script src="../static/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js"></script>
<script src="../static/ajax/libs/bootstrap-table/extensions/export/tableExport.js"></script>
<!-- 遮罩层 -->
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js"></script>
<script src="../static/ajax/libs/iCheck/icheck.min.js"></script>
<script src="../static/ajax/libs/layer/layer.min.js"></script>
<script src="../static/ajax/libs/layui/layui.js"></script>
<script src="../static/ruoyi/js/common.js?v=4.0.0"></script>
<script src="../static/ruoyi/js/ry-ui.js?v=4.0.0"></script>
<script> var ctx = "\/"; </script>


<script src="../static/ajax/libs/jquery-layout/jquery.layout-latest.js"></script>


<script src="../static/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js"></script>

<script>
    var editFlag = "";
    var removeFlag = "";
    var resetPwdFlag = "";
    var prefix = ctx + "system/user";

    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 185});
        //queryUserList();
        //queryDeptTree();
    });

    function queryUserList() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            importUrl: prefix + "/importData",
            importTemplateUrl: prefix + "/importTemplate",
            sortName: "createTime",
            sortOrder: "desc",
            modalName: "用户",
            columns: [{
                checkbox: true
            },
                {
                    field: 'userId',
                    title: '用户ID'
                },
                {
                    field: 'loginName',
                    title: '登录名称',
                    sortable: true
                },
                {
                    field: 'userName',
                    title: '用户名称'
                },
                {
                    field: 'dept.deptName',
                    title: '部门'
                },
                {
                    field: 'email',
                    title: '邮箱',
                    visible: false
                },
                {
                    field: 'phonenumber',
                    title: '手机'
                },
                {
                    visible: editFlag == 'hidden' ? false : true,
                    title: '用户状态',
                    align: 'center',
                    formatter: function (value, row, index) {
                        return statusTools(row);
                    }
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        actions.push('<a class="btn btn-info btn-xs ' + resetPwdFlag + '" href="javascript:void(0)" onclick="resetPwd(\'' + row.userId + '\')"><i class="fa fa-key"></i>重置</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    }

    function queryDeptTree() {
        var url = ctx + "system/dept/treeData";
        var options = {
            url: url,
            expandLevel: 2,
            onClick: zOnClick
        };
        $.tree.init(options);

        function zOnClick(event, treeId, treeNode) {
            $("#deptId").val(treeNode.id);
            $("#parentId").val(treeNode.pId);
            $.table.search();
        }
    }

    $('#btnExpand').click(function () {
        $._tree.expandAll(true);
        $(this).hide();
        $('#btnCollapse').show();
    });

    $('#btnCollapse').click(function () {
        $._tree.expandAll(false);
        $(this).hide();
        $('#btnExpand').show();
    });

    $('#btnRefresh').click(function () {
        queryDeptTree();
    });

    /* 用户管理-部门 */
    function dept() {
        var url = ctx + "system/dept";
        $.modal.openTab("部门管理", url);
    }

    /* 用户管理-重置密码 */
    function resetPwd(userId) {
        var url = prefix + '/resetPwd/' + userId;
        $.modal.open("重置密码", url, '800', '300');
    }

    /* 用户状态显示 */
    function statusTools(row) {
        if (row.status == 1) {
            return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
        } else {
            return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
        }
    }

    /* 用户管理-停用 */
    function disable(userId) {
        $.modal.confirm("确认要停用用户吗？", function () {
            $.operate.post(prefix + "/changeStatus", {"userId": userId, "status": 1});
        })
    }

    /* 用户管理启用 */
    function enable(userId) {
        $.modal.confirm("确认要启用用户吗？", function () {
            $.operate.post(prefix + "/changeStatus", {"userId": userId, "status": 0});
        })
    }
</script>
</body>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据
                &nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
                    class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>